// createRouter方法可以用于创建路由器实例，可以管理多个路由
import { createRouter, createWebHashHistory } from "vue-router";

export default createRouter({
  // 路由的模式设置
  history: createWebHashHistory(),
  // 管理路由
  routes: [
    {
      path: '/',
      redirect: '/home'
    },
    {
      path: '/home',
      name: 'Home',
      component: () => import('@/pages/home/index.vue')
    },
    {
      path: '/hospital',
      name: 'Hospital',
      component: () => import('@/pages/hospital/index.vue'),
      children: [
        {
          path: 'register',
          name: 'Register',
          component: () => import('@/pages/hospital/register/index.vue')
        },
        {
          path: 'detail',
          name: 'Detail',
          component: () => import('@/pages/hospital/detail/index.vue')
        },
        {
          path: 'notice',
          name: 'Notice',
          component: () => import('@/pages/hospital/notice/index.vue')
        },
        {
          path: 'close',
          name: 'Close',
          component: () => import('@/pages/hospital/close/index.vue')
        },
        {
          path: 'search',
          name: 'Search',
          component: () => import('@/pages/hospital/search/index.vue')
        },
      ]
    },
  ],
  // 滚动性：控制滚动条的位置
  // 让页面每次跳转的时候都回到顶部
  scrollBehavior() {
    return {
      lef: 0,
      top: 0
    }
  }
})